<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
   //错误 catch捕捉
   new Promise((resolve,reject)=>{
       //抛错误的方式
    //    reject("错误");
    // reject(new Error("错误"))
    // throw new Error("错误")
    tw+1;
    // tw+1; //promise内部已经写好了一个try...catch...自动执行下面的reason,我们不用写
   }).then(value=>console.log(value),reason=>console.log(reasons));
   .catch(
        error=>{
            console.log(new Error());//处理上面的异常，然后进行捕捉
   });
    </script>
</body>
</html>